-
Couldn't load subscription status.
- Fork 226
Fix #3405 Fix incorrect reuse of code mining annotations with mismatched types #3416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #3405 Fix incorrect reuse of code mining annotations with mismatched types #3416
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the fixes, great work.
Could you please also create a unit test which documents the problem scenario where the CodeMiningType for a given offset is changed?
...org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java
Outdated
Show resolved
Hide resolved
...org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java
Outdated
Show resolved
Hide resolved
...lipse.jface.text.examples/src/org/eclipse/jface/text/examples/codemining/CodeMiningDemo.java
Outdated
Show resolved
Hide resolved
Hi @tobiasmelcher, I was thinking about how to implement a test for my case, but for some reason, some tests, esp. CodeMining test, fail on my machine on the master branch (without my changes), commit hash 0ce1430. I didn't find the reason yet.
|
Test Results 3 018 files ±0 3 018 suites ±0 2h 33m 6s ⏱️ + 13m 51s For more details on these failures, see this check. Results for commit 673bde4. ± Comparison against base commit ce17c9e. ♻️ This comment has been updated with latest results. |
|
Hi @tobiasmelcher and @BeckerWdf, I'm trying to implement a test for issue #3405, but I'm struggling with various issues with running the tests on my machine(s). I might need some help. Some tests fail for the unmodified Eclipse platform UI master branch, commit 0ce1430, on MacOS and on Windows 11 as well. Due to the failing tests, I cannot assure that my new test will behave as expected. In addition, the SWT widgets or the tests seem to behave strange. For example, when debugging my new test case on MacOS, the first line's vertical line indentation is reported to be 16, but the code mining is being drawn onto the source viewer's content instead of drawing it into an extra line (see screenshot 1). The in-line code mining is sometimes also drawn into the source viewer's text (see screeshot 2). The method I've extended the code mining demo where the code minings seem to behave as expected, i.e. drawing a "title" either above a reference (e.g. "REF-X" in my example) in a line header or in the same line in front of the referencing text: It would be great if someone could take a look at my PR draft and help me fixing the tests. |
|
@travkin79 sure, I'll take a look and make a proposal. Please give me some time. I will also check if I can reproduce the other test errors you have mentioned. |
8b1e2fd to
e85cb9d
Compare
|
Thank you @tobiasmelcher, I managed to finish a first version of a test. It turns out, Besides that, there might be an issue with my PR in case that someone is using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@travkin79 : Please
- squash all the changes from 6 commits to one or two.
- Provide meaningful commit message, ideally following https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#commit-message-recommendations
- featch latest master state and rebase your branch on it
- Force push so PR is updated
...org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java
Show resolved
Hide resolved
29e4efd to
fe9f52e
Compare
Done. Thank you for looking at my PR |
|
Hi @tobiasmelcher,
I think, fixing these tests should be done in a separate issue / PR. I just wanted to be sure, that I'm not doing something wrong when running the existing tests. In addition to the tests already mentioned, the following tests do also fail on my machine. I guess, it might be for the same reason. |
@travkin79 : If you want to work with offset 5 inside the unit test implementation, you need to set |
Sure, the tests will be fixed via a separate pull request. |
@travkin79 : This is an important topic. We need to support the case that implementations return only an instance of |
Hi @tobiasmelcher, I could create a separate git branch, where you could reproduce and debug that case on your machine if you like. |
That would be very helpful, thanks. Could you please also tell me then the steps how to reproduce the problem scenario? |
Hi @tobiasmelcher, But checking the implementation in |
That's a compatibility issue. We cannot change the default. Code minings were initially implemented to support the parameter hints where the mining should be drawn before a given parameter. I introduced at a later point in time the |
|
Thank you for the explanation @tobiasmelcher, Surprisingly, setting the default to git branch: https://github.com/travkin79/eclipse.platform.ui/tree/test-code-minings Steps to reproduce Result code-mining-permanent-redrawing-issue.mp4 |
Hi @travkin79 , I changed Can we go with this approach? I did not further analyze the flickering issue and cannot explain what happens. I think we are safe if we can ensure that the new implementation creates the same annotations as before. With best regards, |
|
Hi @tobiasmelcher, Best regards, |
I hope I updated the pull request the correct way? If everything is fine, we need to squash the changes. I can do it if you want. |
|
Hi @tobiasmelcher, |
Drawing code minings depends on the type of code mining annotations that are created for code minings (that are created by code mining providers). When redrawing code minings, the corresponding annotations have to be updated or re-created. The annotations' types have to comply with the code minings' types, i.e. a LineContentCodeMining must go with a CodeMiningLineContentAnnotation, a LineHeaderCodeMining with a CodeMiningLineHeaderAnnotation, and a DocumentFooterCodeMining with a CodeMiningDocumentFooterAnnotation. This PR fixes re-creation of annotations. In some cases, annotations were reused, despite of their wrong type. Now, they are re-created with the required type. The PR also extends the code mining demo to reproduce the issue eclipse-platform#3405 and adds an automated test. Fixes eclipse-platform#3405
b271e0d to
673bde4
Compare
|
Test error in LinkHelperTest.testLinkHelperEditorActivation not related to this change |
|
So is this good to be merged now? |
Yes, from my point of view this pull request is ready to be merged. |
1563627
into
eclipse-platform:master
|
@travkin79: Thanks for providing a PR. |
|
Thank you all for the reviews, analysis, and merging. 👍 |







There are three types of code minings and three corresponding types of annotations. Issue #3405 describes a problem with updating the annotations. In certain cases the annotations are not re-created if the code mining type changes, e.g. from in-line code minings to line header code minings. This PR fixes that issue.
In order to make reviews easy, I left three commits for three different changes. The commits can be squashed if you prefer having only one commit.